<?php

namespace app\common\model\shopro;

use think\Model;

/**
 * 金币提现模型
 */
class WithdrawGoldenModel extends Model
{

    protected $name = 'shopro_withdraw_golden';
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    // 追加属性
    protected $append = [
        'status_text'
    ];
    // 定义获取器，自动格式化时间戳字段
    public function getCreateTimeAttr($value,$data)
    {
        if(isset($data['createtime'])){
            $value = date('Y-m-d H:i:s', $data['createtime']);
        }
        return $value;
    }

    public function getStatusTextAttr($value,$data)
    {
        if(isset($data['status'])){
            if($data['status'] == 0){
                $value = '待审核';
            }elseif ($data['status'] == 1){
                $value = '已通过';
            }else{
                $value = '已驳回';
            }
        }
        return $value; // TODO: Change the autogenerated stub
    }

}
